package cn.conchit.apccontroldemo.graph.cross;

import cn.conchit.apccontroldemo.graph.exception.DirectGraphException;

import java.util.HashSet;
import java.util.List;

/**
 * @author hetao
 * @version 1.0
 * @description: TODO
 * @date 2023/2/15 10:48
 */
public class App {

    public static void main(String[] args) throws DirectGraphException, CloneNotSupportedException {
        IDirectGraph<String, String> directGraph = new CrossLinkGraph<String, String>();
//1. 初始化顶点
        directGraph.addVertex("111Vertex");
        directGraph.addVertex("222Vertex");
        directGraph.addVertex("333Vertex");
        directGraph.addVertex("444Vertex");
        directGraph.addVertex("555Vertex");
        directGraph.addVertex("666Vertex");


//2. 初始化边
        directGraph.addEdge(new Edge<>(1, 2, "1-edge-2"));
        directGraph.addEdge(new Edge<>(1, 3, "1-edge-3"));
        directGraph.addEdge(new Edge<>(1, 4, "1-edge-4"));
        directGraph.addEdge(new Edge<>(2, 5, "2-edge-5"));
        directGraph.addEdge(new Edge<>(3, 5, "3-edge-5"));
        directGraph.addEdge(new Edge<>(4, 6, "4-edge-6"));
        directGraph.addEdge(new Edge<>(5, 6, "5-edge-6"));

        directGraph.removeEdge(2, 5);
        directGraph.removeEdge(3, 5);
        directGraph.removeEdge(5, 6);


        List<HashSet<GraphNode>> seqList =  directGraph.sequence();
        for(int i = 0; i < seqList.size(); i++) {
            System.out.println("第"+(i+1)+"批次：");
            System.out.println(seqList.get(i));
            System.out.println("-----------------------------");
        }

    }


}
